object mainObject {
	def main():Unit={
		{
			println("the array content is :");
			println(new myArray().printArray());
			println("the sum of all the its element is :");
			println(new Sum().getTotal(new myArray().initArray()));
		}
	}
}
class Sum{
	def getTotal(arr:Int[]):Int = {
		var sum : Int;
		var i : Int;
		sum = 0;
		i = 0;
		while(i<arr.length){
			sum = sum+arr[i];
			i = i+1;
		}
		
		return sum;
	}
}

class myArray{

	def initArray():Int[]={
		var arr:Int[];
		var i :Int;
		i = 0;
		arr = new Int[100];
		
		while(i<arr.length){
			arr[i] = i+1;
			i = i+1;
		}
		return arr;
	}
	def printArray():String={
		var arr:Int[];
		var i :Int;
		var acc:String;
		arr = this.initArray();
		acc = ""+arr[0];
		i = 1;
		while(i<arr.length){
			acc = acc+", "+arr[i];
			i = i+1;
		}
		return acc;
	}
}
